# GDB Script: flash_and_run.gdb

# Settings before connecting to target

set confirm off
set pagination off

# set non-stop on  # <--- COMMENT OUT OR REMOVE THIS LINE

# Specify the executable file for symbols
# ===>>> REPLACE 'stm32_blink' with your actual project/executable name <<<===

##如果cargo build --release 指令编译选择这条指令
file target/thumbv7m-none-eabi/release/stm32_blink      

# 如果cargo build  指令编译选择下面这个
#file target/thumbv7m-none-eabi/debug/stm32_blink 
# Connect to OpenOCD
target extended-remote localhost:3333

# Optional: Print target status
monitor version
monitor targets

# Load the program into flash.
load

# Reset the microcontroller and halt it.
monitor reset init

# Optional: Set a breakpoint at the entry point (e.g., main)
# break main

# Continue execution
continue

# Optional: Detach GDB
# detach

# Quit GDB.
quit
